home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / os2 / kzr0597.zip / ARCOSH.CMD < prev    next >
OS/2 REXX Batch file  |  1997-03-10  |  3KB  |  74 lines

  1. /* REXX-Programm arcosh.CMD  */
  2.  
  3.    Call RxFuncAdd 'SysLoadFuncs', RexxUtil, 'SysLoadFuncs'
  4.    Call SysLoadFuncs
  5.    Signal on syntax name arcoshMsg
  6.  
  7. /* Diese Variablen müssen für jede Prozedur definiert werden, damit die  */
  8. /* Prozedur die Variable bufND kennt und die Variable ND übernehmen kann.*/
  9.    Pfd=SysSearchPath("PATH", "kzr.cmd")
  10.    lp=LastPos("\", Pfd)
  11.    Pfd=DelStr(Pfd, 1+lp)
  12.    NDAarcosh=Pfd||"NDAarcosh.DAT"
  13.    bufND  =Pfd||"NDZahl.DAT"
  14.    bufMsg =Pfd||"Meldung.DAT"
  15.    ND = LineIn(bufND, 1)
  16.  
  17.    if ND > 400 then
  18.    do
  19.      ND=400
  20.      call charout(NDAarcosh) ; Call SysFileDelete NDAarcosh
  21.      ret=LineOut(NDAarcosh, 400)
  22.      Call Charout,"   Achtung, nur 400 Dezimalstellen bei der Berechnung von  arcosh(...)"
  23.      say
  24.      Beep(444, 200); Beep(628,300)  /* Hier kein EXIT ! */
  25.    end
  26.  
  27.    /* Wenn ND <= 400 ist, wird ND = ND  weitergegeben */
  28.    call charout(NDAarcosh) ; Call SysFileDelete NDAarcosh
  29.    ret=LineOut(NDAarcosh, ND)
  30.  
  31.    arg x,y  /* y soll "illegale" Komma's im Funktions-Argument aufspüren */
  32.    p0p=x*x  /* Diese Anweisung prvoziert eine Syntax-Fehlermeldung       */
  33.  
  34.    if length(y) > 0 then
  35.    do
  36.      call charout(NDAarcosh); Call SysFileDelete NDAarcosh
  37.      ret=LineOut(bufMsg, "Im Argument von  arcosh(...)  ist mindestens  1  nicht zulässiges Komma !")
  38.      /* "bufMsg" und  "bufND" werden immer beim Beenden von kzr.cmd gelöscht, */
  39.      /*  damit in den diesbezüglichen temporären Dateien                      */
  40.      /*  Meldungen und ND-Werte nicht aneinandergehängt werden.               */
  41.      EXIT
  42.    end
  43.  
  44.    Numeric Digits ND+7
  45.  
  46.    if x < 1 then
  47.    do
  48.      call charout(NDAarcosh); Call SysFileDelete NDAarcosh
  49.      ret=LineOut(bufMsg, "Die Funktion  arcosh(...)  hat für Werte  x < 1  keine reelles Ergebnis.")
  50.      /* "bufMsg" und  "bufND" werden immer beim Beenden von kzr.cmd gelöscht, */
  51.      /*  damit in den diesbezüglichen temporären Dateien                      */
  52.      /*  Meldungen und ND-Werte nicht aneinandergehängt werden.               */
  53.      EXIT
  54.    end
  55.  
  56.    y=ln(x+sqrt(x*x-1))
  57.  
  58.    /* Ausgabe */
  59. W: numeric digits ND
  60.    return(Format(y))
  61.  
  62. arcoshMsg:
  63.    sf=ErrorText(RC)
  64.    if  Pos("Bad arithmetic conversion", sf) > 0 then
  65.    do
  66.      call charout(NDAarcosh); Call SysFileDelete NDAarcosh
  67.      ret=LineOut(bufMsg, "Sie haben in  arcosh(...)  kein gültiges Argument eingegeben !")
  68.   /* "bufMsg" und  "bufND" werden immer beim Beenden von kzr.cmd gelöscht, */
  69.   /*  damit in den diesbezüglichen temporären Dateien                      */
  70.   /*  Meldungen und ND-Werte nicht aneinandergehängt werden.               */
  71.      EXIT
  72.    end
  73.  
  74.